package me.zhengjie.logging.service

import jakarta.servlet.http.HttpServletResponse
import me.zhengjie.logging.domain.SysLog
import me.zhengjie.logging.service.dto.SysLogQueryCriteria
import org.aspectj.lang.ProceedingJoinPoint
import org.springframework.data.domain.Pageable
import org.springframework.scheduling.annotation.Async
import java.io.IOException

/**
 * @author Kuki Wu
 * @date 2024-11-24
 */
interface SysLogService {
    fun queryAll(criteria: SysLogQueryCriteria, pageable: Pageable?): Any?
    fun queryAll(criteria: SysLogQueryCriteria?): List<SysLog?>
    fun queryAllByUser(criteria: SysLogQueryCriteria, pageable: Pageable?): Any?
    fun queryAllByUser(criteria: SysLogQueryCriteria): List<SysLog?>

    @Async
    fun save(username: String?, browser: String?, ip: String?, joinPoint: ProceedingJoinPoint, log: SysLog)

    /**
     * 查询异常详情
     * @param id 日志ID
     * @return Object
     */
    fun findByErrDetail(id: Long?): Any?

    @Throws(IOException::class)
    fun download(queryAll: List<SysLog?>?, response: HttpServletResponse?)

    /**
    * 删除所有错误日志
    */
    fun delAllByError()

    /**
     * 删除所有INFO日志
     */
    fun delAllByInfo()
}